-
Notifications
You must be signed in to change notification settings - Fork 41
Migrating from setuptools to uv #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating from setuptools to uv #114
Conversation
|
@chinacat567 In this case, it would make sense to call the workflow only @CPBridge To automatically publish to PyPI when publishing on GitHub, you must allow this on the PyPI homepage by associating the GitHub repo and workflow with the package (it's quite simple). It would look like this in your case: |
|
@chinacat567 I also think that the configurations in |
Deleted |
|
LGTM now. Looking forward to an upcoming release 🙂. |
|
Thanks! Bit underwater for the next couple of days but I'll take a look later in the week |
CPBridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this nice upgrade @chinacat567 @medihack. I have a few specific comments on the code, and also a question.
I've personally not used automatic versioning before. Can you confirm what is used as the source of the version? Is it the release title or the git tag? I ask because we prepend av in the git tags, but not in the release titles or the version strings and I want to make sure we don't mess this up...
Secondly, there is currently a version number stored within the source code itself in the top level __init__.py such that someone can access dicomweb_client.__version__ within python. From what I can tell, the automatic versioning introduced by this PR would not affect that version string, which would seem to be a big problem. I see the poetry dynamic versioning tool has the capability to do this, but the uv version is very poorly documented as far as I can tell. From what you know, is it possible to have this version string updated automatically too?
uv.lock
Outdated
| @@ -0,0 +1,1226 @@ | |||
| version = 1 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, whether to commit a lockfile for a a library project such as this is a matter of debate. It is not required for anyone installing the library (which simply uses the dependency ranges listed in pyproject.toml) and is basically just for developers to have synced environments. But I imagine this will create a lot of noise in commits as these environments are updated.
I generally come down on the side of not committing lock files, but I could be persuaded if there are specific benefits we get from it (personally I am much less familiar with uv than poetry, which I have mostly been using for the last few years).
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that the usage of lock files is somehow debatable, but I guess, with the increasing spread of uv (and poetry), those are becoming more the default than the exception. I like them for the reproducibility and consistency of my development and testing environment. I also use renovate to automatically update all my dependencies (including the lock files).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the uv.lock file and put *.lock into .gitignore. So it's gone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks, we can maybe revisit if there's a reason in the future. I should clarify that I'm talking purely about library repos, for other types of project (applications) I think it makes a lot of sense.
That said it seems that you added the lock file to the gitignore but didn't actually git rm it, it's still there! @medihack
Ah, ok. I wasn't aware that your tags use a "v" prefix. Dynamic versioning indeed uses the tag and not the release title.
You are right. That is a shortcoming I also wasn't aware of. And unfortunately, I don't know an easy solution for it 😞. The That said, maybe |
I think perhaps this (the hook) could be a solution? |
Ah interesting ... I didn't know about that. I used |
|
I can't check if the correct git tag is picked up as a version. So, if you really want to merge it, try it out manually first before publishing a new release by running |
CPBridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
So, if you really want to merge it, try it out manually first before publishing a new release by running uv build.
I just tried this and it seems to work correctly. I.e. building when at commit tagged with a v (e.g. v0.60.0) produces a version without a v (0.60.0) and when imported, the module's __version__ attribute is the tag without the v (0.60.0)
Just one little thing about the lock file...
uv.lock
Outdated
| @@ -0,0 +1,1226 @@ | |||
| version = 1 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks, we can maybe revisit if there's a reason in the future. I should clarify that I'm talking purely about library repos, for other types of project (applications) I think it makes a lot of sense.
That said it seems that you added the lock file to the gitignore but didn't actually git rm it, it's still there! @medihack
|
Also, any concerns from @pieper before finalising? |
|
|
Another good addition would be to switch from |



Context
Description